<?php
	require_once TEMPLATEPATH.'/incs/resize_image.php';
	$upload = wp_upload_dir();
	$size_x = 100;
	$size_y = 100;
	$image_rs = new SimpleImage();
	$output = null;
	
	while (have_posts())
	{
		the_post();		
		$postID = get_the_ID();
		$thumbnail = db_get_post_meta($postID, $wpdb->prefix.'thumbnail');
		$base_thumbnail = pathinfo($thumbnail);
		$file_name = $base_thumbnail['basename'];		
		//print_r($base_thumbnail);
		$source_file = $upload['basedir'].$upload['subdir'].'/'.$file_name;
		$des_file 	 = $upload['basedir'].$upload['subdir'].'/resize_'.$file_name;
		//echo $source_file;
		if(!file_exists($des_file))
		{
			$image_rs->load($source_file);
		    $image_rs->resize($size_x,$size_y);
		    $image_rs->save($des_file);
		}
		$output.= "		
		<br/> <a href='#' class='mytest'>phan trang</a> <br/>
		
		";
		
	}
	wp_reset_query();
	print_r($output);
?>